local matRefraction	= Material( "refract_ring" )

/*---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
---------------------------------------------------------*/
function EFFECT:Init( data )
	
	local pos = data:GetOrigin() + Vector(0,0,30)
	local ct = data:GetAngle()
	local color = Color(ct.p,ct.y,ct.r,200)
	
	local emitter = ParticleEmitter( pos )
	
	for i=0,math.random(9,13) do
		
		local particle = emitter:Add( "effects/muzzleflash"..math.random(1,4), pos )

		particle:SetVelocity(Vector(math.random(-80, 80),math.random(-80, 80), math.random(-50, 80)))
		particle:SetDieTime( math.Rand(1,1.5) )
		particle:SetStartAlpha( math.Rand( 100, 125 ) )
		particle:SetStartSize( math.Rand( 20, 50 ) )
		particle:SetEndSize( math.Rand( 90, 120 ) )
		particle:SetRoll( math.Rand( -95, 95 ) )
		particle:SetRollDelta( math.Rand( -0.12, 0.12 ) )
		particle:SetColor( color.r,color.g,color.b )
				
		emitter:Finish()
		
	end
	
	for i=0,math.random(4,7) do
	
		local emitter = ParticleEmitter(pos + Vector(0,0,15))
		
		local particle = emitter:Add("effects/combinemuzzle2", pos )
		particle:SetVelocity(Vector(math.random(-40, 40),math.random(-40, 40), math.random(-40, 40)))
		particle:SetDieTime(math.Rand(1,1.2))
		particle:SetStartAlpha(math.random(100,190))
		particle:SetEndAlpha(math.random(1,10))
		particle:SetEndAlpha(50)
		particle:SetStartSize(2)
		particle:SetEndSize(math.Rand(100,150))
		particle:SetRoll(180)
		particle:SetColor( color.r,color.g,color.b )
		emitter:Finish()
		
	end
	
	for i=1,math.random(6,10) do
		
		local particle = emitter:Add( "particles/smokey", pos )

		particle:SetVelocity(Vector(math.random(-70, 70),math.random(-70, 70), math.random(-70, 70)))
		particle:SetDieTime( math.Rand(1,2) )
		particle:SetStartAlpha( math.Rand( 175, 220 ) )
		particle:SetEndAlpha(10)
		particle:SetStartSize( math.Rand( 5, 15 ) )
		particle:SetEndSize( math.Rand( 100, 150 ) )
		particle:SetRoll( math.Rand( -95, 95 ) )
		particle:SetRollDelta( math.Rand( -0.12, 0.12 ) )
		particle:SetColor( 100,100,100 )
				
		emitter:Finish()
		
	end
	
	for i=1,math.random(3,6) do
		local effectdata = EffectData()
		effectdata:SetOrigin(pos)
		effectdata:SetScale(2)
		util.Effect("fire_gib", effectdata)
	end
	
end


/*---------------------------------------------------------
   THINK
   Returning false makes the entity die
---------------------------------------------------------*/
function EFFECT:Think( )
	
end


/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render()

end



